import AgentLayout from '@/views/agent/AgentLayout.vue';

/**
 * 区域代理路由配置
 * 所有区域代理相关页面路由定义
 */
const agentRoutes = [
  {
    path: '/agent',
    component: AgentLayout,
    redirect: '/agent/dashboard',
    children: [
      {
        path: 'dashboard',
        name: 'AgentDashboard',
        component: () => import('@/views/agent/dashboard/DashboardView.vue'),
        meta: {
          title: '区域代理 - 控制台',
          requiresAuth: true,
          role: 'agent',
        },
      },
      {
        path: '/agent/distributors',
        name: 'AgentDistributors',
        component: () =>
          import('@/views/agent/distributors/DistributorsView.vue'),
        meta: {
          title: '区域代理 - 分销商管理',
          requiresAuth: true,
          role: 'agent',
        },
      },
      {
        path: '/agent/orders',
        name: 'AgentOrders',
        component: () => import('@/views/agent/orders/OrdersView.vue'),
        meta: {
          title: '区域代理 - 订单管理',
          requiresAuth: true,
          role: 'agent',
        },
      },
      {
        path: '/agent/finance',
        name: 'AgentFinance',
        component: () => import('@/views/agent/finance/FinanceView.vue'),
        meta: {
          title: '区域代理 - 佣金管理',
          requiresAuth: true,
          role: 'agent',
        },
      },
      {
        path: '/agent/commission',
        name: 'AgentCommission',
        component: () => import('@/views/agent/commission/CommissionView.vue'),
        meta: {
          title: '区域代理 - 佣金管理',
          requiresAuth: true,
          role: 'agent',
        },
        redirect: '/agent/commission/overview',
        children: [
          {
            path: '/agent/overview',
            name: 'AgentCommissionOverview',
            component: () => import('@/views/agent/commission/Overview.vue'),
            meta: {
              title: '区域代理 - 佣金概览',
              requiresAuth: true,
              role: 'agent',
            },
          },
          {
            path: '/agent/commission/records',
            name: 'AgentCommissionRecords',
            component: () => import('@/views/agent/commission/Records.vue'),
            meta: {
              title: '区域代理 - 佣金明细',
              requiresAuth: true,
              role: 'agent',
            },
          },
          {
            path: '/agent/commission/withdraw',
            name: 'AgentCommissionWithdraw',
            component: () => import('@/views/agent/commission/Withdraw.vue'),
            meta: {
              title: '区域代理 - 佣金提现',
              requiresAuth: true,
              role: 'agent',
            },
          },
          {
            path: '/agent/withdrawal',
            name: 'AgentCommissionWithdrawal',
            component: () => import('@/views/agent/commission/Withdrawal.vue'),
            meta: {
              title: '区域代理 - 提现管理',
              requiresAuth: true,
              role: 'agent',
            },
          },
          {
            path: '/agent/rules',
            name: 'AgentCommissionRules',
            component: () => import('@/views/agent/commission/Rules.vue'),
            meta: {
              title: '区域代理 - 佣金规则',
              requiresAuth: true,
              role: 'agent',
            },
          },
        ],
      },
      {
        path: '/agent/statistics',
        name: 'AgentStatistics',
        component: () => import('@/views/agent/statistics/StatisticsView.vue'),
        meta: {
          title: '区域代理 - 数据分析',
          requiresAuth: true,
          role: 'agent',
        },
      },
      {
        path: '/agent/profile',
        name: 'AgentProfile',
        component: () => import('@/views/agent/profile/ProfileView.vue'),
        meta: {
          title: '区域代理 - 个人信息',
          requiresAuth: true,
          role: 'agent',
        },
      },
      {
        path: '/agent/finance/FansPage',
        name: 'AgentFinance/FansPage',
        component: () => import('@/views/agent/finance/FansPage.vue'),
        meta: {
          title: '区域代理 - 个人信息',
          requiresAuth: true,
          role: 'agent',
        },
      },
    ],
  },
];

export default agentRoutes;
